/**
 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package de.hsmannheim.pepa.patientenportal.apanwep.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.json.JSON;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import de.hsmannheim.pepa.patientenportal.apanwep.model.Event_Types_Codes;
import de.hsmannheim.pepa.patientenportal.apanwep.model.Event_Types_CodesModel;
import de.hsmannheim.pepa.patientenportal.apanwep.model.Event_Types_CodesSoap;

import java.io.Serializable;

import java.sql.Types;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * The base model implementation for the Event_Types_Codes service. Represents a row in the &quot;Event_Types_Codes&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link de.hsmannheim.pepa.patientenportal.apanwep.model.Event_Types_CodesModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link Event_Types_CodesImpl}.
 * </p>
 *
 * @author Cedric Nana
 * @see Event_Types_CodesImpl
 * @see de.hsmannheim.pepa.patientenportal.apanwep.model.Event_Types_Codes
 * @see de.hsmannheim.pepa.patientenportal.apanwep.model.Event_Types_CodesModel
 * @generated
 */
@JSON(strict = true)
public class Event_Types_CodesModelImpl extends BaseModelImpl<Event_Types_Codes>
	implements Event_Types_CodesModel {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. All methods that expect a event_ types_ codes model instance should use the {@link de.hsmannheim.pepa.patientenportal.apanwep.model.Event_Types_Codes} interface instead.
	 */
	public static final String TABLE_NAME = "Event_Types_Codes";
	public static final Object[][] TABLE_COLUMNS = {
			{ "Messages_ID", Types.BIGINT },
			{ "Eventtypecodes_ID", Types.BIGINT }
		};
	public static final String TABLE_SQL_CREATE = "create table Event_Types_Codes (Messages_ID LONG not null primary key,Eventtypecodes_ID LONG)";
	public static final String TABLE_SQL_DROP = "drop table Event_Types_Codes";
	public static final String ORDER_BY_JPQL = " ORDER BY event_Types_Codes.Messages_ID ASC";
	public static final String ORDER_BY_SQL = " ORDER BY Event_Types_Codes.Messages_ID ASC";
	public static final String DATA_SOURCE = "myDataSource";
	public static final String SESSION_FACTORY = "mySessionFactory";
	public static final String TX_MANAGER = "myTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.de.hsmannheim.pepa.patientenportal.apanwep.model.Event_Types_Codes"),
			false);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.de.hsmannheim.pepa.patientenportal.apanwep.model.Event_Types_Codes"),
			false);
	public static final boolean COLUMN_BITMASK_ENABLED = false;

	/**
	 * Converts the soap model instance into a normal model instance.
	 *
	 * @param soapModel the soap model instance to convert
	 * @return the normal model instance
	 */
	public static Event_Types_Codes toModel(Event_Types_CodesSoap soapModel) {
		if (soapModel == null) {
			return null;
		}

		Event_Types_Codes model = new Event_Types_CodesImpl();

		model.setMessages_ID(soapModel.getMessages_ID());
		model.setEventtypecodes_ID(soapModel.getEventtypecodes_ID());

		return model;
	}

	/**
	 * Converts the soap model instances into normal model instances.
	 *
	 * @param soapModels the soap model instances to convert
	 * @return the normal model instances
	 */
	public static List<Event_Types_Codes> toModels(
		Event_Types_CodesSoap[] soapModels) {
		if (soapModels == null) {
			return null;
		}

		List<Event_Types_Codes> models = new ArrayList<Event_Types_Codes>(soapModels.length);

		for (Event_Types_CodesSoap soapModel : soapModels) {
			models.add(toModel(soapModel));
		}

		return models;
	}

	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.de.hsmannheim.pepa.patientenportal.apanwep.model.Event_Types_Codes"));

	public Event_Types_CodesModelImpl() {
	}

	@Override
	public long getPrimaryKey() {
		return _Messages_ID;
	}

	@Override
	public void setPrimaryKey(long primaryKey) {
		setMessages_ID(primaryKey);
	}

	@Override
	public Serializable getPrimaryKeyObj() {
		return _Messages_ID;
	}

	@Override
	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey(((Long)primaryKeyObj).longValue());
	}

	@Override
	public Class<?> getModelClass() {
		return Event_Types_Codes.class;
	}

	@Override
	public String getModelClassName() {
		return Event_Types_Codes.class.getName();
	}

	@Override
	public Map<String, Object> getModelAttributes() {
		Map<String, Object> attributes = new HashMap<String, Object>();

		attributes.put("Messages_ID", getMessages_ID());
		attributes.put("Eventtypecodes_ID", getEventtypecodes_ID());

		return attributes;
	}

	@Override
	public void setModelAttributes(Map<String, Object> attributes) {
		Long Messages_ID = (Long)attributes.get("Messages_ID");

		if (Messages_ID != null) {
			setMessages_ID(Messages_ID);
		}

		Long Eventtypecodes_ID = (Long)attributes.get("Eventtypecodes_ID");

		if (Eventtypecodes_ID != null) {
			setEventtypecodes_ID(Eventtypecodes_ID);
		}
	}

	@JSON
	@Override
	public long getMessages_ID() {
		return _Messages_ID;
	}

	@Override
	public void setMessages_ID(long Messages_ID) {
		_Messages_ID = Messages_ID;
	}

	@JSON
	@Override
	public long getEventtypecodes_ID() {
		return _Eventtypecodes_ID;
	}

	@Override
	public void setEventtypecodes_ID(long Eventtypecodes_ID) {
		_Eventtypecodes_ID = Eventtypecodes_ID;
	}

	@Override
	public ExpandoBridge getExpandoBridge() {
		return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
			Event_Types_Codes.class.getName(), getPrimaryKey());
	}

	@Override
	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		ExpandoBridge expandoBridge = getExpandoBridge();

		expandoBridge.setAttributes(serviceContext);
	}

	@Override
	public Event_Types_Codes toEscapedModel() {
		if (_escapedModel == null) {
			_escapedModel = (Event_Types_Codes)ProxyUtil.newProxyInstance(_classLoader,
					_escapedModelInterfaces, new AutoEscapeBeanHandler(this));
		}

		return _escapedModel;
	}

	@Override
	public Object clone() {
		Event_Types_CodesImpl event_Types_CodesImpl = new Event_Types_CodesImpl();

		event_Types_CodesImpl.setMessages_ID(getMessages_ID());
		event_Types_CodesImpl.setEventtypecodes_ID(getEventtypecodes_ID());

		event_Types_CodesImpl.resetOriginalValues();

		return event_Types_CodesImpl;
	}

	@Override
	public int compareTo(Event_Types_Codes event_Types_Codes) {
		long primaryKey = event_Types_Codes.getPrimaryKey();

		if (getPrimaryKey() < primaryKey) {
			return -1;
		}
		else if (getPrimaryKey() > primaryKey) {
			return 1;
		}
		else {
			return 0;
		}
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}

		if (!(obj instanceof Event_Types_Codes)) {
			return false;
		}

		Event_Types_Codes event_Types_Codes = (Event_Types_Codes)obj;

		long primaryKey = event_Types_Codes.getPrimaryKey();

		if (getPrimaryKey() == primaryKey) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return (int)getPrimaryKey();
	}

	@Override
	public void resetOriginalValues() {
	}

	@Override
	public CacheModel<Event_Types_Codes> toCacheModel() {
		Event_Types_CodesCacheModel event_Types_CodesCacheModel = new Event_Types_CodesCacheModel();

		event_Types_CodesCacheModel.Messages_ID = getMessages_ID();

		event_Types_CodesCacheModel.Eventtypecodes_ID = getEventtypecodes_ID();

		return event_Types_CodesCacheModel;
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(5);

		sb.append("{Messages_ID=");
		sb.append(getMessages_ID());
		sb.append(", Eventtypecodes_ID=");
		sb.append(getEventtypecodes_ID());
		sb.append("}");

		return sb.toString();
	}

	@Override
	public String toXmlString() {
		StringBundler sb = new StringBundler(10);

		sb.append("<model><model-name>");
		sb.append(
			"de.hsmannheim.pepa.patientenportal.apanwep.model.Event_Types_Codes");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>Messages_ID</column-name><column-value><![CDATA[");
		sb.append(getMessages_ID());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>Eventtypecodes_ID</column-name><column-value><![CDATA[");
		sb.append(getEventtypecodes_ID());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private static ClassLoader _classLoader = Event_Types_Codes.class.getClassLoader();
	private static Class<?>[] _escapedModelInterfaces = new Class[] {
			Event_Types_Codes.class
		};
	private long _Messages_ID;
	private long _Eventtypecodes_ID;
	private Event_Types_Codes _escapedModel;
}